<?php 
$pattern = '/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{6,}$/';

$string = 'Qwer@1234'; // 示例字符串 
// $string = 'Abc123#1'; // 示例字符串 

// $string = 'Aa#345678'; // 示例字符串  
if (preg_match($pattern, $string)) {  
    echo "匹配成功";  
} else {  
    echo "匹配失败";  
}